package bch.maven.plugin.guava;

import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Multimap;
import com.google.common.collect.Multimaps;

import java.util.Map;

public class FilteredEntryMultimapExample {
    public static void main(String[] args) {
        Multimap<String, Integer> scores = ArrayListMultimap.create();
        scores.put("Alice", 90);
        scores.put("Alice", 75);
        scores.put("Bob", 60);
        scores.put("Bob", 85);
        scores.put("Charlie", 50);

        // 只保留得分 ≥ 80 的条目
        Multimap<String, Integer> highScores = Multimaps.filterEntries(scores,
                (Map.Entry<String, Integer> e) -> e.getValue() >= 80);

        System.out.println("原始 Multimap：" + scores);
        System.out.println("过滤后的高分视图：" + highScores);
    }
}
